/**
 ******************************************************************************
 * @file    USB_Device/CustomHID_Standalone/Src/usbd_customhid_if.c
 * @author  MCD Application Team
 * @version V1.0.0
 * @date    13-March-2015
 * @brief   USB Device Custom HID interface file.
 ******************************************************************************
 * @attention
 *
 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
 *
 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
 * You may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *        http://www.st.com/software_license_agreement_liberty_v2
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ******************************************************************************
 */

/* Includes ------------------------------------------------------------------*/
#include "usbd_customhid_if.h"
#include "main.h"

/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
static int8_t CustomHID_OutEvent(uint8_t event_idx, uint8_t state);
static int8_t CustomHID_Init(void);
static int8_t CustomHID_DeInit(void);

__ALIGN_BEGIN static uint8_t CustomHID_ReportDesc[USBD_CUSTOM_HID_REPORT_DESC_SIZE] __ALIGN_END =
{
		0x06, 0xFF, 0x00,      /* USAGE_PAGE (Vendor Page: 0xFF00)	*/
		0x09, 0x01,            /* USAGE (1)               			*/
		0xa1, 0x01,            /* COLLECTION (Application)      	*/

		/* Report input */
		0x85, REPORT_ID_1, 		/*     REPORT_ID (1)		      */
		0x09, 0x01,            	/*     USAGE (1)	     	  	  */
		0x15, 0x00,            	/*     LOGICAL_MINIMUM (0)        */
		0x25, 0x01,            	/*     LOGICAL_MAXIMUM (1)        */
		0x75, 0x08,            	/*     REPORT_SIZE (8)            */
		0x95, 0xFF, 			/*     REPORT_COUNT (1)           */
		0xB1, 0x82,           	/*    FEATURE (Data,Var,Abs,Vol)  */

		0x85, 0x01,  			/*     REPORT_ID (1)              */
		0x09, 0x01,            	/*     USAGE (LED 1)              */
		0x91, 0x82,            	/*     OUTPUT (Data,Var,Abs,Vol)  */

		/* Report output */
		0x85, REPORT_ID_2,		/*     REPORT_ID                  */
		0x09, 0x02,             /*     USAGE (2)             	  */
		0x15, 0x00,             /*     LOGICAL_MINIMUM (0)        */
		0x26, 0xff, 0x00,       /*     LOGICAL_MAXIMUM (255)      */
		0x75, 0x08,             /*     REPORT_SIZE (8)            */
		0x95, 0xFF, 		 	/*     REPORT_COUNT (1)           */
		0x81, 0x82,             /*     INPUT (Data,Var,Abs,Vol)   */
		0xc0 	                /*     END_COLLECTION	          */
}; 

USBD_CUSTOM_HID_ItfTypeDef USBD_CustomHID_fops = 
{
		CustomHID_ReportDesc,
		CustomHID_Init,
		CustomHID_DeInit,
		CustomHID_OutEvent,
};

/* Private functions ---------------------------------------------------------*/

/**
 * @brief  CustomHID_Init
 *         Initializes the CUSTOM HID media low layer
 * @param  None
 * @retval Result of the opeartion: USBD_OK if all operations are OK else USBD_FAIL
 */
static int8_t CustomHID_Init(void)
{
	return (0);
}

/**
 * @brief  CustomHID_DeInit
 *         DeInitializes the CUSTOM HID media low layer
 * @param  None
 * @retval Result of the opeartion: USBD_OK if all operations are OK else USBD_FAIL
 */
static int8_t CustomHID_DeInit(void)
{
	/*
  Add your deinitialization code here
	 */
	return (0);
}


/**
 * @brief  CustomHID_OutEvent
 *         Manage the CUSTOM HID class Out Event
 * @param  event_idx: LED Report Number
 * @param  state: LED states (ON/OFF)
 */
static int8_t CustomHID_OutEvent(uint8_t reportNum, uint8_t state)
{
	/* blink led, indication receive packet */
	LED_GREEN_0;


	return (0);
}

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
